<#include "../macro/seller.html" />
<@layout>
<!-- content start -->
<script type="text/javascript">

	function toDetail(num_iid,title){
  		window.location.replace("../selleradmin/toProductDetail?numid="+num_iid+"&title="+title);
  	};
  	function query()
  	{
  		var searchkey=document.getElementById("searchkey").value;
		window.location.replace("../selleradmin/toProductList?searchkey="+searchkey+"&pageNo=1");

  	}
  	function refresh()
  	{
  		window.location.replace("../selleradmin/toProductList?pageNo=1");
  	}
  	function havesize()
  	{
  		window.location.replace("../selleradmin/toProductList?havesize=true&pageNo=1");
  	}
  	function nosize()
  	{
  		window.location.replace("../selleradmin/toProductList?havesize=false&pageNo=1");
  	}
	function changebox(box){
		var commentlist = document.getElementsByName("checkbox");
		if(box.checked){
			for (var i = 0; i < commentlist.length; i++) {
				commentlist[i].checked = true;
			};
		}else{
			for (var i = 0; i < commentlist.length; i++) {
				commentlist[i].checked = false;
			};
		}
	}  
	/*发布or取消发布*/
	function pubnish(state,numid){
		window.location.replace("../selleradmin/toProductList?state="+state+"&numid="+numid+"&pageNo=1");	
	}
	/*调到设置banner页面*/
	function setBanner(){
		var numids="";
		var commentlist = document.getElementsByName("checkbox");
		for (var i = 0; i < commentlist.length; i++) {
			if(commentlist[i].checked == true){
				if(commentlist[i].title=="未添加"){
					alert('请添加选中商品的尺码后再设置显示图片');
					return;
				}
				numids+=commentlist[i].id+",";
			}
		};
		if(numids==""){
			alert("请先选择要设置的商品！");
			retrun;
		}
		window.location.replace("../selleradmin/toSetBanner?numids="+numids);	
	}
	
	function gotoPage(){
		$(".gotopage").css("display","block");
	}
	function gotopro(){
		var pageNo=$("#pageNo").val();
		var pageCount=${pageCount};
		if(pageNo>pageCount){
			alert("超出总页数！");
			return;
		}
		window.location.replace("../selleradmin/toProductList?pageNo="+pageNo);
	}
	
  </script>
    <style>
  		.pages{
  			width: 100%;
  			height: 30px;
  			float: right;
  		}
  		.pages .pages-div{
  			padding-right:10px;
  			font-size:13px;
  			text-align: right;
  		}
  		.gotopage{
  			position:relative;
  			display:none;
  			float:right;
  			width: 185px;
  			height: 50px;
  			padding:5px;
  			font-size:14px;
		    border: 3px solid #dedede;
		    -moz-border-radius: 5px;      /* Gecko browsers */
		    -webkit-border-radius: 5px;   /* Webkit browsers */
    		border-radius:5px;            /* W3C syntax */
  		}
  </style>
 
  <div class="admin-content">
    <div class="am-cf am-padding">
      <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">商品列表</strong></div>
    </div>

    <div class="am-g">
      <div class="am-u-sm-12 am-u-md-6">
        <div class="am-btn-toolbar">
          <div class="am-btn-group am-btn-group-xs">
            <button type="button" class="am-btn am-btn-default" onclick="refresh()"><span class="am-icon-refresh"></span> 刷新</button>
            <button type="button" class="am-btn am-btn-default" onclick="havesize()"><span class="am-icon-archive"></span> 已录入鞋码</button>
            <button type="button" class="am-btn am-btn-default" onclick="nosize()"><span class="am-icon-save"></span> 未录入鞋码</button>
          </div>
        </div>
      </div>
      <!-- 
      <div class="am-u-sm-12 am-u-md-3">
        <div class="am-form-group">
          <select data-am-selected="{btnSize: 'sm'}">
            <option value="option1">所有类别</option>
            <option value="option2">IT业界</option>
            <option value="option3">数码产品</option>
            <option value="option3">笔记本电脑</option>
            <option value="option3">平板电脑</option>
            <option value="option3">只能手机</option>
            <option value="option3">超极本</option>
          </select>
        </div>
      </div>
       -->
      <div class="am-u-sm-12 am-u-md-3">
        <div class="am-input-group am-input-group-sm">

          <input id="searchkey" type="text" class="am-form-field" />

          <span class="am-input-group-btn">
            <button class="am-btn am-btn-default" type="button" onclick="query()">搜索</button>
          </span>
        </div>
      </div>
    </div>

    <div class="am-g">
      <div class="am-u-sm-12">
        <form class="am-form">
          <table class="am-table am-table-striped am-table-hover table-main">
            <thead>
              <tr>
                <th><input type="checkbox" id="all" onchange="changebox(this)"></th><th class="table-title">商品</th><th class="table-type">测码人数</th><th class="table-author am-hide-sm-only">尺码状态</th><th class="table-author am-hide-sm-only">发布状态</th><th class="table-set">操作</th>
              </tr>
          </thead>
          <tbody>
   
			<#if products??>
				<#list products as list>
					<tr>
					  <td width="10px;"><input type="checkbox" id="${list.num_iid!}" name="checkbox" title="<#if list.size_status?? && list.size_status == "未添加">未添加<#else>已添加</#if>"></td>
		              <td><#if list.size_status?? && list.size_status == "未添加"><font color="red" style="cursor:pointer" onclick="toDetail('${list.num_iid!}','${list.title!}')">${list.title!}</font><#else><span  style="cursor:pointer" onclick="toDetail('${list.num_iid!}','${list.title!}')">${list.title!}</span></#if></td>
		              <td>${list.useCount!}</td>
		              <td><#if list.size_status?? && list.size_status == "未添加">未添加<#else>已添加</#if></td>
		              <td class="am-hide-sm-only">${list.publish!}</td>
		              <td>
		                <div class="am-btn-toolbar">
		                  <div class="am-btn-group am-btn-group-xs">
		                    <button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="toDetail('${list.num_iid!}','${list.title!}')"><span class="am-icon-pencil-square-o"></span> 编辑鞋码</button>
		                 	 <#if list.publish?? && list.publish == "已发布">
		                 	 	<button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="pubnish(0,'${list.num_iid!}')"><span class="am-icon-pencil-square-o"></span>取消发布</button>
		                  	 </#if>
		                  </div>
		                </div>
		              </td>
		            </tr>
				</#list>
            </#if>
          </tbody>
        </table>
        <!-- 分页 开始-->
         <div class="gotopage"><P style="height: 30px;margin-top: 5px;padding-left: 10px;">跳转到第<input type="text" id="pageNo" style="padding:0px;margin-bottom:3px;width: 30px;height: 20px;line-height: 20px;font-size:14px;display: inline;color: black;">&nbsp;页&nbsp;<input type="button" onclick="gotopro()" value="确定" style="width:40px;height: 25px;line-height: 20px;padding: 0px;margin: 0px;background-color: white;"/></P></div>
        <div class="pages">
        	<div class="pages-div">
        		<span>${pageNo!}/${pageCount!}&nbsp;页</span>&nbsp;&nbsp;<a href="../selleradmin/toProductList?pageNo=${pageNo-1}" style="<#if pageNo==1>display:none<#else>display:''</#if>" title="">上一页</a>&nbsp;<a href="../selleradmin/toProductList?pageNo=${pageNo+1}" style="<#if pageNo==pageCount>display:none<#else>display:''</#if>">下一页</a>&nbsp;<a href="javascript:" onclick="gotoPage()">跳转</a>
        	</div>
        </div>
       
        <!-- 分页 结束-->
        	<p style="text-align: center;width: 100%;margin-top: 60px;">
        		<button type="button" class="am-btn am-btn-secondary"
				onclick="setBanner()">设置显示图片</button>
        	</p>
          <div class="am-cf">
  共 ${num!} 条记录

</div>
          <hr />
          <p>注：.....</p>
        </form>
      </div>

    </div>
  </div>

  
  <!-- content end -->
</@layout>